home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / ae / code / ax3.00 / upload_a_file.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-01-03  |  36.9 KB  |  1,216 lines

  1. #include "bbs.h"
  2. #include <utility/tagitem.h>
  3. #include <dos/dostags.h>
  4.  
  5. extern char *SkipdFiles;
  6. extern char WorkStr[];
  7. int AEGoodFile;
  8. int rzmsg=0;
  9. extern char prototitle[];
  10. static int Test_File(char *str,char *path);
  11. static void DisplayOutPutofTest(void)
  12. {
  13.  sprintf(GSTR3,"%sWORK/OutPut_Of_Test",NodeStr);
  14.  (void)MenuSend(GSTR3);
  15. }
  16. int checksym;
  17. //FILE *fr = NL ,*fw = NL;
  18. BOOL LocalUpload=0;
  19. extern int XIMPort;
  20. /* temp = extension */
  21. struct TagItem filetags[]={ {SYS_Input,0},{SYS_Output,0},{NP_StackSize,0},{NP_Priority,0},{TAG_DONE,0}};
  22.  
  23. static int CheckFileExternal(int *stat,char *temp,char *CheckFile)
  24. {
  25.    BPTR fi;
  26.    FILE *fi1;
  27.    struct DiskObject *dobj;
  28.    char **tooltypes;
  29.    char *s;
  30.    int i;
  31.    char FileName[256],Options[256], image[256];
  32.  
  33.    /* what happens if we look for this file but the dir is non-existant ? */
  34.    sprintf(FileName,"%sFCheck/%s",Cmds->BBSLoc,temp);
  35.    
  36.    dobj=GetDiskObject(FileName);
  37.    if(dobj==NULL) return(0);
  38.    *(stat)=SUCCESS;
  39.    tooltypes=dobj->do_ToolTypes;
  40.    if(s=FindToolType(tooltypes,"CHECKER"))
  41.    {
  42.       strcpy(Options,s);
  43.    }
  44.    else return(0);
  45.    if(s=FindToolType(tooltypes,"OPTIONS"))
  46.    {
  47.      strcat(Options," "); strcat(Options,s);
  48.    }
  49.    if(s=FindToolType(tooltypes,"STACK"))
  50.    {
  51.      filetags[2].ti_Data=(ULONG)atol(s);
  52.    }else filetags[2].ti_Data=4096L;
  53.    if(s=FindToolType(tooltypes,"PRIORITY"))
  54.    {
  55.      filetags[3].ti_Data=(ULONG)atoi(s);
  56.    }
  57. //(RTS)
  58.    strcat(Options," ");strcat(Options,CheckFile);
  59.    sprintf(FileName,"%sOutPut_Of_Test",WorkStr);
  60.    if((fi=Open(FileName,MODE_NEWFILE))!=NULL)
  61.    {
  62.      filetags[1].ti_Data=fi;
  63.      SystemTagList(Options,filetags);
  64.      Close(fi);
  65.      DisplayOutPutofTest();
  66.      sprintf(Options,"%sOutPut_Of_Test",WorkStr);
  67.      i=1; sprintf(FileName,"ERROR.%d",i++);
  68.      while(s=FindToolType(tooltypes,FileName))
  69.      {
  70.         fi1=fopen(Options,"r");
  71.         while(fgets(image,80,fi1)!=NULL)
  72.         {
  73.           if(strstr(image,s)){ *(stat)=FAILURE; break; }
  74.         }
  75.         if(*(stat)==FAILURE){ fclose(fi1); break;}
  76.         fclose(fi1);
  77.         sprintf(FileName,"ERROR.%d",i++);
  78.      }
  79.      DeleteFile(Options);
  80.    }else { FreeDiskObject(dobj); return(0); }
  81.    FreeDiskObject(dobj);
  82.    return(1);
  83. }
  84.  
  85. static int Test_File(char *str,char *path)
  86. {
  87.  int x,x2,stat;
  88.  char temp[100],temp2[100];
  89.  char temp3[100],temp4[100];
  90.  char Options[200];
  91.  strcpy(temp,str);
  92.  x=0;
  93.  
  94. sprintf(temp3,"%scommands/syscmd/",Cmds->BBSLoc);
  95.  do  {
  96.  if(temp[x]=='.') {
  97.      x2=0;
  98.      do {
  99.          temp2[x2]=temp[x+x2+1];
  100.          x2+=1;
  101.      }  while(temp[x+x2+1]!='\0');
  102.      temp2[x2]='\0';
  103.      (void)strupr(temp2);
  104.      if(strlen(temp2)==3) {
  105.          strcpy(Options,path);
  106.          stat=NOTALLOWED;AEGoodFile=NOTALLOWED;
  107.           sprintf(temp4,"FILECHECK %s",temp);
  108.           if(!CustomCommand(temp3,temp4,1))
  109.           {
  110.             AEPutStr("Testing ...");
  111.             AEPutStr(FilePart(str));
  112.             AEPutStr("\r\n");
  113.  
  114.           strcat(Options,temp);
  115.           CheckFileExternal(&stat,temp2,Options);
  116.           }
  117.           else
  118.           {
  119.              stat=AEGoodFile;
  120.              if(stat==NOTTESTED)
  121.              { 
  122.                stat=NOTALLOWED;
  123.               strcat(Options,temp);
  124.              CheckFileExternal(&stat,temp2,Options);
  125.              } 
  126.          }
  127.          return(stat);
  128.      }             /* end if strlen */
  129.  }                 /* end if temp */
  130.  x+=1;
  131.  } while(x<strlen(temp));        /* end do */
  132.  return(NOTALLOWED);
  133. }
  134.  
  135. extern int NumSkipd,zresume;
  136. extern BYTE BeenUDd;
  137. extern char RecFileNames[];
  138. extern long Time_limit;
  139.  
  140. int PGoodbye(void);
  141.  
  142.  
  143. extern struct myst my_struct;
  144.  
  145. static long RFreeSpace(char *path)   /* get free space on drives */
  146. {
  147.  BPTR FLock;
  148.  struct InfoData *i_data;
  149.  
  150.  long stat=0;
  151.  
  152.  if(i_data=(struct InfoData *)AllocMem((long)sizeof(struct InfoData),MEMF_CHIP)) {
  153.      if(FLock = Lock(path,ACCESS_READ)) {
  154.          if(stat=Info(FLock,i_data))
  155.              stat=(i_data->id_NumBlocks*i_data->id_BytesPerBlock)-(i_data->id_NumBlocksUsed*i_data->id_BytesPerBlock);
  156.          else {
  157.              sprintf(GSTR3,"\r\nCan not get info from %s for free space\r\n",path);
  158.              AEPutStr(GSTR3);
  159.          }
  160.          UnLock(FLock);
  161.      } else {
  162.          sprintf(GSTR3,"\r\nCan not find free space for %s\r\n",path);
  163.          AEPutStr(GSTR3);
  164.      }
  165.      FreeMem(i_data,sizeof(struct InfoData));
  166.  } else
  167.      MyError(0);
  168.  
  169.  return(stat);
  170. }
  171.  
  172. static long FreeDiskSpace(void)
  173. {
  174.  char string[200],path[100];
  175.  struct DiskObject *dobj;
  176.  char **oldtooltypes;
  177.  char *s;
  178.  long TFS,FSU;
  179.  int drivenum=1;
  180.  
  181.  sprintf(string,"%sDRIVES",Cmds->BBSLoc);
  182.  
  183.  TFS=0;
  184.  if(dobj=GetDiskObject(string))
  185.  {
  186.     oldtooltypes=dobj->do_ToolTypes;
  187.     sprintf(path,"DRIVE.%d",drivenum++);
  188.     while(s=FindToolType(oldtooltypes,path))
  189.     {
  190.        strcpy(path,s);
  191.        FSU=RFreeSpace(path);
  192.          TFS+=FSU;
  193.        sprintf(path,"DRIVE.%d",drivenum++);
  194.     }
  195.     FreeDiskObject(dobj);
  196.  }
  197.  else
  198.  {   sprintf(GSTR3,"\r\nThe file %s.info is missing!!!\r\n\r\n",string);
  199.      AEPutStr(GSTR3);
  200.      return(FAILURE);
  201.  }
  202.  
  203. return(TFS);
  204. }
  205.  
  206. /* Clean up the work Directory */
  207.  
  208. static void CleanItUp(void)
  209. {
  210.  BPTR FLock;
  211.  struct FileInfoBlock *Fib;
  212.  register int i;                  /* 11w add */
  213.  char *s;
  214.  int cnt = 0;
  215.  
  216.  strcpy(GSTR3,WorkStr);
  217.  i=strlen(GSTR3)-1;
  218.  while(i) { if(GSTR3[i]<=' ' || GSTR3[i]=='/') GSTR3[i]='\0'; else break;
  219.  i--;}
  220.  
  221.   if((Fib =(struct FileInfoBlock *) AllocDosObject(DOS_FIB,NULL)) == NL) {
  222.      MyError(0);     return;
  223.  }
  224.    /* lock the directory (Playpen or RamPen */
  225.  if((FLock = Lock(GSTR3,ACCESS_READ)) == 0) {
  226.      MyError(8);     goto ef;
  227.  }
  228.  
  229.  if((Examine(FLock,Fib)) == 0) {
  230.      MyError(6);     goto ef;
  231.  }
  232.  
  233.  if(Fib->fib_DirEntryType > 0) {   /* make sure we locked a directory */
  234.      while(ExNext(FLock,Fib)) {
  235.          if(Fib->fib_DirEntryType < 0) {   /* found a file */
  236. /* * * ERROR CHECKING * * */
  237.              /* or we can change to &Fib->fib_FileName[0] */
  238.              if(strlen(Fib->fib_FileName) == 0) {   /* check for filename > 0 length */
  239.                  goto ef;
  240.              }
  241.  
  242.              cnt = 0;
  243.              s = Fib->fib_FileName;
  244.              while(*s && cnt < 30) {     /* check for valid file name */
  245.                  if(*s == ' ') {     /* check for spaces at beginning of filename */
  246.                      goto ef;
  247.                  }
  248.                  if(*s == '/') {
  249.                      goto ef;
  250.                  }
  251.                  if(!(isascii((int) *s))) {
  252.                      goto ef;
  253.                  }
  254.                  cnt++;
  255.                  s++;
  256.              }
  257.  
  258. /* * * END ERROR CHECKING * * */
  259.  
  260.  
  261.              sprintf(GSTR3,"%s%s",WorkStr,Fib->fib_FileName);   /* 11w */
  262.              DeleteFile(GSTR3);
  263.            
  264.  
  265.          } /* end if(Fib->fib_DirEntryType < 0) */
  266.  
  267.      }   /* end while(ExNext(FLock,Fib)) */
  268.  
  269.   }     /* end  if(Fib->fib_DirEntryType > 0) */
  270.  
  271. ef: ;
  272.   if(FLock) UnLock(FLock);
  273.   if(Fib) FreeDosObject(DOS_FIB,Fib);
  274. }
  275.  
  276.  
  277.  
  278.  
  279. static int UploadDesc(void)
  280. {
  281.  int status,x,count;
  282.  char str[255],str2[255],odate[50],str3[200],str4[200],buff[255];
  283.  FILE *udf;
  284.  
  285.  CleanItUp();
  286.  AEPutStr("Batch UpLoading.....\r\n");
  287.  AEPutStr("\r\nUnlimited files.  Blank Line to start transfer.\r\n");
  288.  
  289.  count=0;
  290.  FOREVER {
  291.      count+=1;
  292.      sprintf(str,"\r\nFileName %d: ",count);
  293.      AEPutStr(str);
  294.      status=LineInput("",str,12,KEYBOARD_TIMEOUT);
  295.      if(status<0)  return(status);
  296.      if((str[0]=='A'||str[0]=='a')&&strlen(str)==1) {
  297.          AEPutStr("\r\n");
  298.          return(FAILURE);
  299.      }
  300.      if(strlen(str)==0)  {
  301.          AEPutStr("\r\n");
  302.          break;
  303.      }
  304.      status=Check_For_File(str);   /* is file online ?? */
  305.      if(status==FAILURE) {
  306.          AEPutStr("File Exists, or has a symbol (#?*).\r\n");
  307.          count-=1;
  308.          continue;
  309.      }
  310.  
  311.      sprintf(str4,"%s%s",WorkStr,str);             /* 11w add */
  312.  
  313.      udf=fopen(str4,"r");
  314.      if(udf!=NULL) {
  315.          AEPutStr("You can't Upload a duplicate.\r\n");
  316.          count-=1;
  317.          fclose(udf);
  318.          continue;
  319.      }
  320.      Time_system=time(NULL);
  321.      sprintf(str2,"%s",ctime(&Time_system));
  322.      Convert_CTime_To_Date(str2,odate,str3);
  323.  
  324. CINPAgain:
  325.      sprintf(buff,"\r\nPlease enter a description, you only have %d lines.",my_struct.max_desclines);
  326.      AEPutStr(buff);
  327. /* renamed Spazm to sysops *///JOE 26-Jun
  328.      AEPutStr("\r\nPress return alone to end.  Begin  with (/) to make upload 'Private' to Sysop.\r\n");
  329.      AEPutStr("                                [--------------------------------------------]\r\n");
  330.      sprintf(str2,"%-13s                   :",str);
  331.      AEPutStr(str2);
  332.      /*---11 w */
  333.       /*-- end  11w */
  334.      status=LineInput("",str2,44,KEYBOARD_TIMEOUT);
  335.      if(status<0)  return(status);
  336.      if(strlen(str2)==0) { count-=1; continue; }
  337.      udf=fopen(str4,"w");
  338.      if(udf==NULL) {
  339.          MyError(7);
  340.          //AEPutStr("Tell sysop the system can't open a file in the work dirs\r\n\r\n");
  341.          return(FAILURE);
  342.      }
  343.      fprintf(udf,"%s\n",str2);
  344.      x=0;
  345.      do  {
  346.          AEPutStr("                                :");
  347.          status=LineInput("",str2,44,KEYBOARD_TIMEOUT);
  348.          if(status<0) { fclose(udf); DeleteFile(str4); return(status); }
  349.          if(strlen(str2)!=0)         fprintf(udf,"%s\n",str2);
  350.          x+=1;
  351.      } while(strlen(str2)!=0&&x<(my_struct.max_desclines-1));
  352.      fclose(udf);
  353.  
  354.  }
  355.  AEPutStr("Okay:   (Enter) to Start, (G)oodbye after transfer, (A)bort? ");
  356.  
  357.  do  {
  358.      status=Check_Online_Status();
  359.      if(status<0) return(status);
  360.      status=ReadChar(KEYBOARD_TIMEOUT);
  361.      if(status<(-1))  return(status);
  362.  
  363.      if((status==65) || (status==97)) {
  364.          AEPutStr("Abort!\r\n\r\n");
  365.          return(FAILURE); }
  366.      if((status=='L' || status=='l') && XIMPort==CONSOLE_PORT) { 
  367.         status=13; LocalUpload=1; break; }
  368.  } while(((status!=13L)&&(status!=71L)&&(status!=103L)));
  369.  
  370.  if(status!=13)  {
  371.      AEPutStr("Goodbye!\r\n\r\n");
  372.      return(2);
  373.  } else  AEPutStr("\r\n\r\n");
  374.  return(1);
  375. }
  376.  
  377.  
  378. static long MoveFile(char *filename,long filesize)
  379. {
  380. long stat,err;
  381. int pathnum;
  382. int goodtogo=0;
  383.  if(filesize == 0) {
  384.      ErrorLog("(mf 518)\n");
  385.      return(0);
  386.  }
  387.  
  388.  filesize=filesize+16384;
  389.  
  390.      pathnum=1;
  391.      sprintf(GSTR3,"ULPATH.%d",pathnum++);
  392.      while(GetFromConf(CN-1,GSTR3,GSTR3)) {
  393.          stat=RFreeSpace(GSTR3);
  394.             if(Sopt->RamPen[0]!=NULL)      sprintf(GSTR1,"%s/%s",Sopt->RamPen,filename);
  395.              else            sprintf(GSTR1,"%sPLAYPEN/%s",NodeStr,filename);
  396.              sprintf(GSTR2,"%s%s",GSTR3,filename);
  397.          if(Rename(GSTR1,GSTR2))
  398.          {
  399.            DeleteFile(GSTR1);
  400.            sprintf(GSTR1,"\tUpload moved to %s\n",GSTR2);
  401.            CallersLog(GSTR1);
  402.            AEPutStr(" File Posted\r\n\r\n");
  403.            return(1);
  404.          }
  405.          if(stat>filesize) {
  406.              goodtogo=1;
  407.              if(stat=FileCopy(GSTR1,GSTR2)) {
  408.                  DeleteFile(GSTR1);
  409.                  sprintf(GSTR1,"\tUpload moved to %s\n",GSTR2);
  410.                  CallersLog(GSTR1);
  411.                  AEPutStr(" File Posted\r\n\r\n");
  412.                  return(1);
  413.              }
  414.          }
  415.        sprintf(GSTR3,"ULPATH.%d",pathnum++);
  416.      } 
  417.     if(!goodtogo)
  418.     {
  419.     AEPutStr("WARNING!\r\nNO FREE SPACE on any path!  Moving to upload dir...");
  420.     ErrorLog("WARNING!NO FREE SPACE on any path!  Moving to upload dir...\n");
  421.     }
  422.  
  423.     AEPutStr("FAILURE!!!  unable to move file!\r\n\r\n");
  424.     sprintf(GSTR1,"\tFAILURE!, unable to move file %s from PlayPen\n",filename);
  425.     CallersLog(GSTR1);
  426.      if(Sopt->RamPen[0]!=NULL)      sprintf(GSTR1,"%s/%s",Sopt->RamPen,filename);
  427.              else            sprintf(GSTR1,"%sPLAYPEN/%s",NodeStr,filename);
  428.     DeleteFile(GSTR1);
  429.     return(0);
  430. }
  431.  
  432. static void CleanPlayPen(void)
  433. {
  434.  int stat,err;
  435.  BPTR FLock;
  436.  struct FileInfoBlock *Fib;
  437.  char *s;
  438.  int cnt = 0;
  439.  
  440.  if(Sopt->RamPen[0]!=NULL) strcpy(GSTR1,Sopt->RamPen);
  441.  else  sprintf(GSTR1,"%sPlaypen",NodeStr);
  442.  
  443.  if((Fib = (struct FileInfoBlock *)AllocDosObject(DOS_FIB,NULL)) == NL) {
  444.      MyError(0);     return;
  445.  }
  446.    /* lock the directory (Playpen or RamPen */
  447.  if((FLock = Lock(GSTR1,ACCESS_READ)) == 0) {
  448.      MyError(8);     goto fx;
  449.  }
  450.  
  451.  if((Examine(FLock,Fib)) == 0) {
  452.      MyError(6);     goto fx;
  453.  }
  454.  
  455.  if(Fib->fib_DirEntryType > 0) {   /* make sure we locked a directory */
  456.      while(ExNext(FLock,Fib)) {
  457.          if(Fib->fib_DirEntryType < 0) {   /* found a file */
  458.              /* or we can change to &Fib->fib_FileName[0] */
  459.              if(strlen(Fib->fib_FileName) == 0) {   /* check for filename > 0 length */
  460.                  goto fx;
  461.              }
  462.  
  463.              cnt = 0;
  464.              s = Fib->fib_FileName;
  465.              while(*s && cnt < 30) {     /* check for valid file name */
  466.                  if(*s == ' ') {     /* check for spaces at beginning of filename */
  467.                      goto fx;
  468.                  }
  469.                  if(*s == '/') {
  470.                      goto fx;
  471.                  }
  472.                  if(!(isascii((int) *s))) {
  473.                      goto fx;
  474.                  }
  475.                  cnt++;
  476.                  s++;
  477.              }
  478.  
  479.              /* get our copy to Filename */
  480.              sprintf(GSTR2,"%sPartUpload/%s@%d",Conference_Location,Fib->fib_FileName,User.Slot_Number);
  481.              if(Sopt->RamPen[0]!=NULL) {
  482.                  sprintf(GSTR1,"%s/%s",Sopt->RamPen,Fib->fib_FileName);
  483.                  do {
  484.                      if(GSTR1[strlen(GSTR1)-1] == '/') {
  485.                          goto fx;
  486.                      }
  487.  
  488.                      /* again not error, only for testing */
  489.                      /* check for valid copy */
  490.                      stat=FileCopy(GSTR1,GSTR2);
  491.                      if(!stat)   strcat(GSTR2,"_");
  492.  
  493.                  } while(!stat&&(strlen(GSTR2)<40));
  494.  
  495.              }          /* end if RamPen */
  496.               else {    /* uploading to hdrive */
  497.                  sprintf(GSTR1,"%sPlaypen/%s",NodeStr,Fib->fib_FileName);
  498.                  stat=Rename(GSTR1,GSTR2);
  499.                  err=IoErr();
  500.                  if(!stat&&err==213) {
  501. /* sx:  */           do {
  502.                          if(GSTR1[strlen(GSTR1)-1] == '/') {
  503.                              goto fx;
  504.                          }
  505.                          /* again not error, only for testing */
  506.                          /* check for valid filename */
  507.                          stat=FileCopy(GSTR1,GSTR2);
  508.                          if(!stat) strcat(GSTR2,"_");
  509.                          else  {
  510. #ifdef RTS
  511. //(RTS) Sat Jun  6 21:23:40 1992  .. set cause we never knew we lost carrier with a parcial
  512. // upload, there for when we went back from upload_a_file we didnt return goodbye or lost_carrier
  513.  
  514. //                         part_upload = TRUE;
  515. #endif
  516.                          }
  517.                      } while(!stat&&(strlen(GSTR2)<40));
  518.                   }          /* end if(!stat&&err==213 */
  519.              }              /* end else */
  520.              if(stat)  DeleteFile(GSTR1);
  521.  
  522.          }                       /* end if(Fib->fib_DirEntryType < 0)  */
  523.      }                           /* end while(ExNext(FLock,Fib))       */
  524.  }                               /* end if(Fib->fib_DirEntryType > 0)  */
  525.  
  526. fx: ;
  527.   if(FLock) UnLock(FLock);
  528.   if(Fib) FreeDosObject(DOS_FIB,Fib);
  529. }
  530.  
  531. static void SysopULStats(int holdflag)
  532. {
  533.  int num;
  534.  char str[256],str2[256];
  535.  FILE *ff;
  536.  
  537.  sprintf(str,"%sSysopStats/NumULs_%d",Cmds->BBSLoc,CN);
  538.  if(holdflag)
  539.      strcat(str,"HOLD");
  540.  
  541.  num=0;
  542.  if((ff= fopen(str,"r"))) {
  543.      fgets(str2,20,ff);
  544.      num=(int)atol(str2);
  545.      fclose(ff);
  546.  }
  547.  num+=1;
  548.  ff=fopen(str,"w");
  549.  if(ff==NULL)    return;
  550.  fprintf(ff,"%d\n",num);
  551.  fclose(ff);
  552. }
  553.  
  554. static int ResumeStuff(long TFS,long FSUploading)
  555. {
  556.  int status,ch;
  557.  char string[256],path[256],ray2[256],ray[256],str[256];
  558.  struct FileInfoBlock *FBlock;
  559.  BPTR FLock;
  560.  long stat,err;
  561.  
  562.  strcpy(path,Conference_Location);
  563.  strcat(path,"PartUpload/");
  564.  
  565.  if(!(FLock = Lock(path,ACCESS_READ))) {    //(RTS) replaced no err cking version below
  566.     MyError(8);
  567.     return(-1);
  568.  }                                                     // was MEMF_CHIP
  569.  if((FBlock=(struct FileInfoBlock *)AllocDosObject(DOS_FIB,NULL)) == NULL) {
  570.      MyError(0); //(RTS)
  571.      UnLock(FLock);
  572.      return(-1);
  573.  }
  574.  
  575.  if(!(Examine(FLock,FBlock))) {
  576.       FreeDosObject(DOS_FIB,FBlock);
  577.       UnLock(FLock);
  578.       MyError(6);
  579.       return(-1);
  580.  }
  581.  
  582. //ADD THIS !!
  583.  
  584.  while ((ExNext(FLock,FBlock))!=0) {  //(RTS)
  585.      strcpy(str,FBlock->fib_FileName);
  586.      strcpy(ray2,str);
  587.      status=GetUN(str);  /* returns user number from end of file name */
  588.      if(status==User.Slot_Number) {
  589.          sprintf(string,"Resume %-12s [%6ld] (Y/N)? ",str,FBlock->fib_Size);
  590.          AEPutStr(string);
  591.          FOREVER {
  592.              ch=Check_Online_Status();
  593.              if(ch<0) {
  594.                  FreeDosObject(DOS_FIB,FBlock);
  595.                  if(FLock) UnLock(FLock); //(RTS) Lock held
  596.                  return(ch);
  597.              }
  598.              ch=ReadChar(KEYBOARD_TIMEOUT);
  599.              if(ch==TIMEOUT) {
  600.                  FreeDosObject(DOS_FIB,FBlock);
  601.                  if(FLock) UnLock(FLock); //(RTS) Lock held
  602.                  return(NO_CARRIER);
  603.              }
  604.              if(ch=='N' || ch=='n')  {
  605.                  AEPutStr("No!   Delete (Y/N)? ");
  606.                  PurgeLine();
  607.                  FOREVER {
  608.                      ch=ReadChar(KEYBOARD_TIMEOUT);
  609.                      if(ch==TIMEOUT) {
  610.                          FreeDosObject(DOS_FIB,FBlock);
  611.                          if(FLock) UnLock(FLock); //(RTS) Lock held
  612.                          return(NO_CARRIER);
  613.                      }
  614.                      if(Whence_The_Logon>=REMOTE_LOGON) {
  615.                          status=CheckCarrier();
  616.                          if(status==FALSE) {
  617.                              FreeDosObject(DOS_FIB,FBlock);
  618.                              if(FLock) UnLock(FLock); //(RTS) Lock held
  619.                              return(NO_CARRIER);
  620.                          }
  621.                      }
  622.                      if(ch=='N' || ch=='n')  {
  623.                          AEPutStr("No!\r\n");
  624.                          goto DirCont;
  625.                      }
  626.                      if(ch=='Y' || ch=='y')  break;
  627.                      else  continue;
  628.                  }        /* end first forever */
  629.                  AEPutStr("Yes.. Deleted!\r\n");
  630.                  strcpy(string,path);
  631.                  strcat(string,ray2);
  632.                  DeleteFile(string);
  633.                  goto DirCont;
  634.              }  /* end if ch == 'n */
  635.              if(ch=='Y' || ch=='y')  break;
  636.              else  continue;
  637.          }   /* end 2nd forever */
  638.          AEPutStr("Yes..\r\n");
  639.          sprintf(string,"\r\nResuming upload: %s\r\n\r\n",str);
  640.          AEPutStr(string);      /* filename */
  641.          strcat(path,ray2);     /* conf_loc:filename/ */
  642.  
  643.          if(Sopt->RamPen[0]!=NULL) {
  644.            strcpy(ray,Sopt->RamPen);  /* should be filename without @name */
  645.            strcat(ray,"/");
  646.            strcat(ray,str);    /* should be old partial file with @num on end */
  647.  
  648.            stat=FileCopy(path,ray);  /* path = filename +@num */
  649.  
  650.          } else {
  651.              strcpy(ray,NodeStr);   /* Node0: etc. */
  652.              strcat(ray,"Playpen/");
  653.              strcat(ray,str);       /* filename */
  654.              stat = FileCopy(path,ray);      /* rename file */
  655.  
  656.          }
  657.          if(stat==1) DeleteFile(path);
  658.  
  659.          if(FBlock) FreeDosObject(DOS_FIB,FBlock);
  660.          if(FLock) UnLock(FLock);
  661.          return(1);
  662. DirCont:
  663.          ;
  664.     }            /* if status & user name */
  665.  }
  666.  if(FBlock) FreeDosObject(DOS_FIB,FBlock);
  667.  if(FLock)  UnLock(FLock);
  668.  return(0);
  669. }
  670.  
  671.  
  672. int Zmodem_Receive(char *, int);
  673.  
  674. extern char  PurgeScanNM[];
  675. extern long fsize;
  676. static FILE *f;
  677.  
  678.  
  679. int Upload_a_File(int ULFType)            // JOE
  680. {
  681.  struct FileInfoBlock *FBlock;
  682.  BPTR FLock;
  683.  int x,x2,x3,cnt,status,MoveToLCFILES,hold,cstat,NoF,lcfile;
  684.  int status2,gstat;
  685.  long peff,pcps,TFS,FSUploading;
  686.  char path[256],str[255],Istr[255],str2[255];
  687.  char list[1024],fmtstr[256];
  688.  char odate[20],fcomment[256],scomment[9][50];
  689.  char ray[256],ray2[256],temp[256],string[256];
  690.  char buff[255];
  691.  FILE *uaf;
  692.  int FoundDupe=0;
  693.  int mstat;      /* check for carrier. trying to stop upload guru from parcial upload */
  694.  
  695.   /* these two for testing asCII chars */
  696.  int cnt1 = 0;
  697.  char *s;
  698.  
  699.  Online_NFiles=0;
  700.  NumSkipd=0;
  701.  
  702.  
  703.  if(MaxDirs==0) {
  704.      AEPutStr("\r\n");
  705.      MyError(5);             //Sorry no files in conf
  706.      return(FAILURE);
  707.  }
  708.  
  709.  if(!ULFType)    {
  710.      strcpy(GSTR1,Screen_Location);
  711.      strcat(GSTR1,"UploadMsg");
  712.      ChecktoDisplay(GSTR1,GSTR3,0,1);
  713.  }
  714.  
  715.  TFS=FreeDiskSpace();                /* check free space */
  716.  if(TFS==FAILURE)    return(0);
  717.  
  718.  if(Sopt->RamPen[0]!=NULL) sprintf(path,"%s/",Sopt->RamPen);
  719.  else sprintf(path,"%sPlaypen/",NodeStr);
  720.  
  721.  FSUploading=RFreeSpace(path);
  722.  
  723.  if((FSUploading)<2000000L) {   /* Do we have 2 megs or free space ?? */
  724.      MyError(9);            /* no free space */
  725.      return(0);
  726.  }
  727.  if(!ULFType) {
  728.      status=CommandSplit();
  729.      if(status>1) {
  730.          strcpy(string,Command[1]);
  731.          SetProtocol(string);
  732.      } else {
  733.          GSTR1[0]='\0';
  734.          SetProtocol(GSTR1);
  735.      }
  736.      switch(User.Protocol) {
  737.          case 'Z':
  738.              if(Sopt->RamPen[0]!=NULL)                     /* are we uploading to a diff device */
  739.                  sprintf(buff,"%s UPLOADING to %s..\r\n",prototitle,Sopt->RamPen);
  740.              else                        /* otherwise normal upload to playpen dir */
  741.                  sprintf(buff,"%s UPLOADING....\r\n",prototitle);
  742.  
  743.              AEPutStr(buff);                              /* show it to the user */
  744.              break;
  745.      }
  746.      sprintf(string,"%lu free bytes available for uploading.  %lu at one time.\r\n",TFS,FSUploading);
  747.      AEPutStr(string);
  748.      AEPutStr("Filename lengths above 12 are not allowed.\r\n\r\n");
  749.  
  750.      switch(User.Protocol) {
  751.          case 'Z':
  752.              zresume=ResumeStuff(TFS,FSUploading);
  753.              if(zresume<0) return(zresume);
  754.              if(zresume==0&&MAINMENU_Li[1]=='R'&&MAINMENU_Li[2]=='G') {
  755.                  AEPutStr("\r\nThere are no more files to resume on.\r\n\r\n");
  756.                  return(0);
  757.              }
  758.              if(zresume==0)  {
  759.                  gstat=UploadDesc();
  760.                  if(gstat<0) {
  761.                      CleanItUp();
  762.                      return(gstat);
  763.                  }
  764.              }
  765.              break;
  766.      }
  767.  }
  768.  
  769.  
  770. /* if user used 'rz' it never entered the above loop so gstat never got set */
  771.  
  772.  /* uploading to another device?? */
  773.  if(Sopt->RamPen[0]!=NULL) sprintf(path,"%s/",Sopt->RamPen);
  774.  else sprintf(path,"%sPlaypen/",NodeStr);
  775.  
  776.  DTBT=0;
  777.  TBT=NULL;
  778.  TTTM=NULL;
  779.  TTEFF=NULL;
  780.  TTCPS=NULL;
  781.  
  782.  if(!BeenUDd) {
  783.      DisplayUserToCallersLog(1);
  784.      BeenUDd=1;
  785.  }
  786.  
  787.  switch(User.Protocol) {
  788.      case 'Z':
  789.          Zmodem_Receive(path,ULFType);     /* path of upload */
  790.          break;
  791.  }
  792.  
  793.  AEPutStr("\r\n\r\nFile Uploading Complete...\r\n");
  794.  
  795.  peff=NULL;
  796.  pcps=NULL;
  797.  if(Online_NFiles!=NULL) {
  798.      peff=(TTEFF/Online_NFiles);
  799.      pcps=(TTCPS/Online_NFiles);
  800.  }
  801.  
  802.  if( (pcps > (long) User_keys.UPcps) || (User_keys.UPcps > 5000)) {
  803.         User_keys.UPcps = (UWORD) pcps;
  804.  
  805.  }
  806.  sprintf(string," %d file(s), %ldk bytes, %ld minute(s). %ld second(s), %ld cps, %ld %% efficiency."
  807.      ,Online_NFiles,(TBT/1024L),(TTTM/60L),(TTTM%60L),pcps,peff);
  808.  
  809.  AEPutStr(string);
  810.  AEPutStr("\r\n\r\n");
  811.  
  812.  strcpy(str,"\t");
  813.  strcat(str,string);
  814.  strcat(str,"\n");
  815.  
  816.  if(Online_NFiles>0) {
  817.      (void)CallersLog(str);
  818.      (void)UDLog(str);
  819.  } else {
  820.      (void)CallersLog("\tUpload Failed..\n");
  821.      (void)UDLog("\tUpload Failed..\n");
  822.  }
  823.  
  824.  peff=(((TTTM*3L)/2L)+60L);
  825.  if(Online_NFiles<1)  peff=0L;
  826.  
  827.  
  828.  if(NumSkipd>0)  {
  829.      AEPutStr("The file(s) :\r\n");
  830.      x=0;
  831.      while(x<NumSkipd) {
  832.          sprintf(str,"\t\t%s \r\n",SkipdFiles+(x*32));
  833.          AEPutStr(str);
  834.          sprintf(str,"\tSkipped %s\n",SkipdFiles+(x*32));
  835.          CallersLog(str);
  836.          UDLog(str);
  837.          x+=1;
  838.      }
  839.      AEPutStr("\r\n\t\tSKIPPED.  They already exist or have symbols.\r\n");
  840.  }
  841.  
  842.  sprintf(str,"Time increased by %d mins.\r\n\r\n",peff/60L);
  843.  AEPutStr(str);
  844.  
  845.  Time_limit+=peff;    /* add time to user while online */
  846.  
  847.  /* dunno why cause we dont return shit */
  848.  Check_Online_Status();    /* can return no carrier */
  849.  
  850.  if(Cmds->AcLvl[LVL_KEEP_UPLOAD_CREDIT]>0)        User.Time_Total+=(peff/2);
  851.  
  852.  MoveToLCFILES=0;
  853.  hold=0;
  854.  lcfile=0;
  855.  strcpy(list,RecFileNames);
  856.  if(Cmds->AcLvl[LVL_CAPITOLS_in_FILE]==1)       strupr(list);
  857.  
  858.  NoF=0;
  859.  cnt=0;
  860.  
  861.  /* loop thru uploaded (ing) list of files & move to where they belong*/
  862. /* this gets the list of files uploaded */
  863.  
  864.  for(x=0;x<strlen(list);++x) {
  865. nx:  ;
  866.      if(list[x]!=' ') {
  867.          str[cnt]=list[x];
  868.          ++cnt;
  869.      } else {
  870.          str[cnt]='\0';
  871.          NoF+=1;
  872.          MoveToLCFILES=0;
  873.          hold=0;
  874.          lcfile=0;
  875.          if(NoF>Online_NFiles)    goto Eit;
  876.         
  877.          cnt=0;   /* reset to zero */
  878.  
  879.          if(strlen(str)>0) {
  880.              if((strlen(str)>12)&&(MoveToLCFILES==NULL)) {
  881.                  /* if we loose carrier here with a +++, it will show up as
  882.                  the file name so check for carrier now */
  883.  
  884.                  sprintf(fmtstr,"%s is too long a name, please rename.\r\n\r\n",str);
  885.                  AEPutStr(fmtstr);
  886.                  AEPutStr("             [------------]");
  887. INPAgain:
  888.                  if(Whence_The_Logon>=REMOTE_LOGON) {
  889.                      cstat=CheckCarrier();
  890.                      if(cstat==FALSE) {
  891.                          MoveToLCFILES=1;
  892.                          goto CLGO;
  893.                      }
  894.                  }
  895.                  AEPutStr("\r\nNew Filename: ");
  896.                  status=LineInput("",Istr,12,KEYBOARD_TIMEOUT);
  897.                  if(status<0) { MoveToLCFILES=1; ModemOffHook();}
  898.                  if(strlen(Istr)==0)  goto INPAgain;
  899.  
  900.                  if( (Istr[0]=='R' && Istr[1]=='Z') && strlen(Istr) == 2) {
  901.                       AEPutStr("\r\nRZ is an invalid name for a file\r\n");
  902.                       goto INPAgain;
  903.                  }
  904.  
  905.                  x2=0;
  906.                  do {          /* CHECK THE STRING */
  907.                      if(Istr[x2]==':' || Istr[x2]=='/' || Istr[x2]=='*' || Istr[x2]==' ' || \
  908.                         Istr[x2]=='#' || Istr[x2] == '+' || Istr[x2] == '?') {
  909.                          MyError(10);  // AEPutStr("\r\nYou may not include any special symbols\r\n");
  910.                          goto INPAgain;
  911.                      }
  912.                      ++x2;
  913.                  } while(x2<strlen(Istr));
  914.  
  915.                  status=Check_For_File(Istr); /* should include RZ */
  916.                  if(status==FAILURE) {
  917. sprintf(GSTR3,"The name %s is used, please rename.\r\n",Istr);
  918.  AEPutStr(GSTR3);
  919.                      goto INPAgain;
  920.                  }
  921.  
  922.                  if(Sopt->RamPen[0]!=NULL) {                       /* check Ram dir */
  923.                      sprintf(GSTR2,"%s/%s",Sopt->RamPen,Istr);
  924.                      sprintf(GSTR3,"%s/%s",Sopt->RamPen,str);
  925.  
  926.                  }  else {
  927.                      sprintf(GSTR2,"%sPlayPen/%s",NodeStr,Istr);
  928.                      sprintf(GSTR3,"%sPlayPen/%s",NodeStr,str);
  929.                  }
  930.  
  931.                  status=Rename(GSTR3,GSTR2);        /* oldstr, newstr */
  932.                  if(status==NULL) {
  933.                      sprintf(GSTR3,"The name %s is used, please rename.\r\n",Istr);
  934.  AEPutStr(GSTR3);
  935.                      goto INPAgain;
  936.                  }
  937.                  strcpy(str,Istr);
  938.                  if(Cmds->AcLvl[LVL_CAPITOLS_in_FILE]==1)  /* use upper case only */
  939.                      strupr(str);
  940.  
  941.                  AEPutStr("\r\n");
  942.              }    /* end if str > 12 */
  943.  
  944.              /*===================== jump here if we also lost carrier ========*/
  945. ax:          Time_system=time(NULL);
  946.              sprintf(fmtstr,"%s",ctime(&Time_system));
  947.              Convert_CTime_To_Date(fmtstr,odate,temp);
  948.  
  949.              /* add our check for ram playpen */
  950.              if(Sopt->RamPen[0]!=NULL)   sprintf(str2,"%s/%s",Sopt->RamPen,str);
  951.               else        sprintf(str2,"%sPlaypen/%s",NodeStr,str);
  952.  
  953.              if((FLock = Lock(str2,ACCESS_READ)) == NULL) {
  954.                  MyError(8);
  955.                  goto nx;
  956.              }
  957.  
  958.              if((FBlock=(struct FileInfoBlock *)AllocDosObject(DOS_FIB,NULL)) == NULL) {
  959.                  MyError(11);
  960.                  UnLock(FLock);
  961.                  return(FAILURE);
  962.              }
  963.              if( Examine(FLock,FBlock) )     fsize = FBlock->fib_Size;
  964.              UnLock(FLock);
  965.              FreeDosObject(DOS_FIB,FBlock);
  966. #ifdef OLDCODE
  967.              if(MoveToLCFILES) goto CLGO;
  968. #endif
  969. CINPAgain:
  970.            if(Whence_The_Logon>=REMOTE_LOGON)
  971.            {
  972.              cstat=CheckCarrier();
  973.              if(cstat==FALSE) {
  974.                  MoveToLCFILES=1;
  975.                  goto CLGO;
  976.              }
  977.            }
  978.              sprintf(fmtstr,"%s%s",WorkStr,str);   /* 11w */
  979.              uaf=fopen(fmtstr,"r");
  980.              if(uaf==NULL) {
  981. #ifdef JOE_AECODE
  982.           AEPutStr("\r\nPlease enter a description, you have eight lines for your description.");
  983.           AEPutStr("\r\nPress return alone to end.  Begin description with (/) to make upload 'Private'.\r\n");
  984.           AEPutStr("                                [--------------------------------------------]\r\n");
  985. #else
  986.  
  987.                  sprintf(buff,"\r\nEnter a description, you only have %d lines.",my_struct.max_desclines);
  988.                  AEPutStr(buff);
  989.  
  990.                  AEPutStr("\r\nPress return alone to end.  Begin description with (/) to make upload 'Private'.\r\n");
  991.                  AEPutStr("                                [--------------------------------------------]\r\n");
  992. #endif
  993.                  sprintf(fmtstr,"%-13s %7ld  %s :",str,fsize,odate);
  994.                  AEPutStr(fmtstr);
  995. CLGO:
  996.                  if(MoveToLCFILES==1) {
  997.  
  998.                      x2=0;
  999.  
  1000.                      strcpy(fcomment,"LOST CARRIER ");
  1001.                      strcat(fcomment,User.Name);
  1002.                      goto CNext;
  1003.                  }
  1004.                  status=LineInput("",fcomment,44,KEYBOARD_TIMEOUT);
  1005.                  if(status<0) { MoveToLCFILES=1; ModemOffHook(); goto CLGO; }
  1006.                  if(strlen(fcomment)==0)  goto CINPAgain;
  1007.  
  1008.                  if( (fcomment[0] == 'R' || fcomment[0] == 'r') && \
  1009.                        (fcomment[1] == 'Z' || fcomment[1] == 'z') && \
  1010.                        (strlen(fcomment) < 4) )
  1011.                       goto CINPAgain;
  1012.  
  1013.                 /* stop that B0 shit */
  1014.                 if(fcomment[0] == 'B' && fcomment[1] =='0')
  1015.                       goto CINPAgain;
  1016.  
  1017.                  s = fcomment;
  1018.                  cnt1 = 0;
  1019.                  while(*s && cnt1 < 20) {
  1020.                      if(!(isascii((int) *s))) {
  1021.                         goto CINPAgain;
  1022.                      }
  1023.                      cnt1++;
  1024.                      s++;
  1025.                  }
  1026.  
  1027.                  x2=0;
  1028.                  do {
  1029.                      AEPutStr("                                :");
  1030.                      status=LineInput("",scomment[x2],44,KEYBOARD_TIMEOUT);
  1031.                      if(status<0) { MoveToLCFILES=1; ModemOffHook(); goto CLGO; }
  1032.                      x2+=1;
  1033.                  } while(strlen(scomment[x2-1])!=0&&x2< (my_struct.max_desclines-1));
  1034.  
  1035.              } else {
  1036.                  fgets(fcomment,80,uaf);
  1037.                  fcomment[strlen(fcomment)-1]='\0';
  1038.                  x2=0;  while(fgets(scomment[x2],80,uaf)!=NULL)
  1039.                  {
  1040.                      status=strlen(scomment[x2]);
  1041.                      if(status>0)
  1042.                          scomment[x2][status-1]='\0';
  1043.                      x2+=1;
  1044.                    if(x2>=(my_struct.max_desclines-1)) break;
  1045.                  } 
  1046.                   if(uaf) fclose(uaf);
  1047.              }
  1048. CNext:
  1049.              status2=NOTALLOWED;
  1050.              if(!MoveToLCFILES && !rzmsg)
  1051.              {
  1052.              sprintf(fmtstr,"\r\nTesting... %s...\r\n",str);
  1053.              status2=Test_File(str,path);
  1054.              if(status2==NOTALLOWED||status2==SUCCESS)
  1055.                  AEPutStr("\r\nTested Ok...");
  1056.  
  1057.              }
  1058.              status=Check_For_File(str);
  1059.  
  1060.             if(MoveToLCFILES==1) status=LCFILES;
  1061.              else
  1062.                  if(fcomment[0]=='/' && rzmsg==NULL){ status=PRIVATE;}
  1063.  
  1064.              if(status2==FAILURE) {            /* Move to a Hold AREA */
  1065.                  hold=1;
  1066.                  sprintf(WORKB,"Requires review, possibly bad format\r\n\t  Moving to %s's private Directory.\r\n\r\n",Cmds->SysopName);
  1067.                  AEPutStr(WORKB);
  1068.                  goto Move_It;
  1069.              }
  1070.  
  1071.  
  1072.  
  1073.              if(status==FAILURE) {             /* Move to a Hold AREA */
  1074.                  if(FoundDupe)  {              /* 11w */
  1075.                      sprintf(WORKB,"\r\nFile already exists, moving to %s's private directory\r\n",Cmds->SysopName);
  1076.                      AEPutStr(WORKB);
  1077.                      hold=1;
  1078.                  }
  1079.  
  1080.              }
  1081.              if(status==SUCCESS) {            /* Move to Upload AREA */
  1082.                  hold=NULL;
  1083.                  User.Uploads+=1;
  1084.              }
  1085.              if(status==LCFILES)  {            /* 11w */
  1086.                  lcfile=1; rzmsg=NULL;
  1087.                  AEPutStr("\r\nCarrier lost, moving to lost carrier directory.\r\n");
  1088.  
  1089.              }
  1090.              if(status==PRIVATE) {             /* Private Upload */
  1091.                  hold=1; rzmsg=NULL;
  1092.                  sprintf(WORKB,"\r\nMoving to %s's private directory.\r\n\r\n",Cmds->SysopName);
  1093.                  AEPutStr(WORKB);
  1094.              }
  1095.              if(rzmsg)
  1096.                 AEPutStr("\r\nMoving to message base file directory.\r\n");
  1097. Move_It:     /* gets here if lostcarrier, and file is complete but not when file is incomplete */
  1098.              if(hold || lcfile || rzmsg) {       /* 11w added lcfile */
  1099.                 if(lcfile)
  1100.                     sprintf(GSTR2,"%sLCFILES/%s",Conference_Location,str);
  1101.                 if(hold) sprintf(GSTR2,"%sHOLD/%s",Conference_Location,str);
  1102.                 if(rzmsg) sprintf(GSTR2,"%sF%ld/%s",MsgBase_Location,MailHeader.MsgNumb,str);
  1103.                
  1104.                  if(Sopt->RamPen[0]!=NULL) {
  1105.                      sprintf(GSTR1,"%s/%s",Sopt->RamPen,str);
  1106.                  }else
  1107.                    sprintf(GSTR1,"%sPLAYPEN/%s",NodeStr,str);
  1108.                  status=0;
  1109.                  while(strlen(FilePart(GSTR2))<35 && !status)
  1110.                  {
  1111.                    status=Rename(GSTR1,GSTR2);
  1112.                    if(!status) {
  1113.                             status=FileCopy(GSTR1,GSTR2);
  1114.                            if(!status) strcat(GSTR2,"_");
  1115.                            if(status) DeleteFile(GSTR1); 
  1116.                     }
  1117.                  }
  1118.                  strcpy(GSTR1,"\tUpload ");
  1119.                  if(status==NULL) {
  1120.                          sprintf(WORKB,"WARNING!\r\nUnable to move file!\r\n");
  1121.                     AEPutStr(WORKB);
  1122.                      strcat(GSTR1,"unable to be ");
  1123.                  }
  1124.                  sprintf(GSTR3,"moved to %s\n",GSTR2);
  1125.                  strcat(GSTR1,GSTR3);
  1126.                  CallersLog(GSTR1);
  1127.              } else
  1128.                  MoveFile(str,fsize);
  1129.  
  1130.              SysopULStats(hold);
  1131.              /* Add Uploaded Bytes to Users Account */
  1132.              if(hold==NULL && lcfile==NULL && rzmsg==NULL)  User.Bytes_Upload+=fsize;
  1133.  
  1134.              /* Build the first line to send to upload dir */
  1135.              if(lcfile && strlen(str) > 12) {
  1136.                      sprintf(fmtstr,"%s %7ld  %s  %s\n",str,fsize,odate,fcomment);
  1137.               } else
  1138.                  sprintf(fmtstr,"%-13s %7ld  %s  %s\n",str,fsize,odate,fcomment);
  1139.  
  1140.              if(strlen(str) < 13) {      /* for big file name on lost carrier */
  1141.                 if(checksym)    fmtstr[13]=checksym;
  1142.                 else
  1143.                 {
  1144.                 
  1145.                 if(status2==FAILURE)     fmtstr[13]='F';
  1146.                 if(status2==SUCCESS)     fmtstr[13]='P';
  1147.                 if(status2==NOTALLOWED)  fmtstr[13]='N';
  1148.                 }
  1149.              }
  1150.              if(FoundDupe) { fmtstr[13]='D'; FoundDupe = 0; }
  1151.              
  1152.  
  1153.              if(hold==NULL && lcfile==NULL) {
  1154.                   if(!rzmsg) 
  1155.                  {
  1156.                  strcpy(ray,Conference_Location);
  1157.                  strcat(ray,"DIR");
  1158.                  sprintf(ray2,"%d",MaxDirs);
  1159.                  strcat(ray,ray2);
  1160.                  }
  1161.                  else sprintf(ray,"%sF%ld/%s.dis",MsgBase_Location,MailHeader.MsgNumb,str);
  1162.              } else {
  1163.                  strcpy(ray,Conference_Location);
  1164.                  if(lcfile)  {
  1165.                     strcat(ray,"LCFILES/");
  1166.                     strcat(ray,PurgeScanNM);
  1167.                     strcat(ray,".lc");
  1168.                  } else
  1169.                     strcat(ray,"HOLD/HELD");
  1170.              }
  1171.  
  1172.              f=fopen(ray,"a");
  1173.              fprintf(f,"%s",fmtstr);
  1174.              x3=0;
  1175.              while(x2) {
  1176.                  /* Print the comment lines */
  1177.                  if(scomment[x3][0]!='\0')
  1178.                  fprintf(f,"                                 %s\n",scomment[x3++]);
  1179.                  x2-=1;
  1180.              }
  1181.              if(GET_BIT(ACS_SENTBY_FILES))   /* Print the Sent by: line */
  1182.                  fprintf(f,"                                 Sent by: %s\n",User.Name);
  1183.              fclose(f);
  1184.          }   /*if strlen > 1 */
  1185.        }
  1186.      }       /* else */
  1187. Eit:
  1188. //PurgeLine();
  1189.  
  1190.  
  1191.  CleanPlayPen();
  1192.  
  1193.  
  1194.  CleanItUp();
  1195.  
  1196. /* we get here after lcfile but gugued*/
  1197.  if(!lcfile) BytesADL+=TBT;     /* dont add bytes if files moved to LCFILES DIR */
  1198.  
  1199.  DisplayULStats(&User);          /* Show User stats.. Num Dnloads, uploads */
  1200.  AEPutStr("\r\n");
  1201.  
  1202.  mstat=Check_Online_Status();
  1203.  if(mstat<0) {
  1204.      return(mstat);
  1205.  }
  1206.  
  1207.  
  1208.  if(!ULFType) {     /* nor a rz upload */
  1209.      if(gstat==2) {
  1210.       return(PGoodbye());
  1211.      }
  1212.  }
  1213.  
  1214.  return(SUCCESS);
  1215. }
  1216.